import $http from "@/utils/http/index";
import type {
	PublicThingReq,
  IRes,
	DeleteThingByIdReq,
	UpdateStatusByIdReq,
	LogPvReq,
  GetThingReq,
  GetThingByTagReq,
  GetThingByTypeReq,
  GetThingByIdReq,
  GetThingByKeyReq
} from "../type/thing";


// 发布启事
export function publicThing(data: PublicThingReq) {
  return $http.post<IRes>({
		url: "/api/thing/public",
		data
	});
}

export function getThingType() {
  return $http.get<IRes>({
		url: "/api/thing/getThingType",
	});
}

export function getThingStatus() {
  return $http.get<IRes>({
		url: "/api/thing/getThingStatus",
	});
}

export function getAllThing(data: GetThingReq) {
  return $http.get<IRes>({
    url: "/api/thing/getAllThing",
    params:data
	});
}

export function getThingInfoById(data: GetThingByIdReq) {
  return $http.get<IRes>({
    url: "/api/thing/getThingInfoById",
    params: data
  });
}

export function deleteThing(data: DeleteThingByIdReq) {
  return $http.patch<IRes>({
		url: "/api/thing/removeThing",
		data
	});
}

export function updateStatusById(data: UpdateStatusByIdReq) {
  return $http.patch<IRes>({
		url: "/api/thing/updateStatus",
		data
	});
}

export function logPv(data: LogPvReq) {
  return $http.patch<IRes>({
		url: "/api/thing/logPv",
		data,
	});
}